#ifndef NANE_TIME_H
#   define  NANE_TIME_H

#   include "nane/core/crt/ITimeSystem.h"
#   include "nane/core/stackstring.h"
#   include "nane/core/crt/Context.h"
#   include "nane/core/Holder.h"

namespace nane
{
    template<class S>
    class TimeSystemHolder
        : public Holder<S>
    {
    };
    
    template<>
    class TimeSystemHolder<ITimeSystem>
        : public Holder<ITimeSystem>
    {
    public:
        static ITimeSystem* Instance()
        {
            if( s_instance == NULL )
            {
                s_instance = nane::m_context->timeSystem;
            }
            return s_instance;            
        }
    };
    
    class Time
    {
    public:
        static bool Initialize();
        static void Shutdown();
        
        static uint32 GetMilliseconds()
        {
            return TimeSystemHolder<ITimeSystem>::Instance()->GetMilliseconds();
        }
        
        static StackString<16> GetLocalDate();
        static StackString<16> GetLocalTime();
        
    private:
        class Implementation;
    };
}   // namespace nane

#endif	// NANE_TIME_H

